<!DOCTYPE html>
<html>
<head>
	<title>Using Grid API Methods</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		var myGrid;
		function doOnLoad(){
			myGrid = new dhtmlXGridObject('gridbox');
			myGrid.setImagePath("../../../codebase/imgs/");
			myGrid.setHeader("Column A, Column B");
			myGrid.setInitWidths("100,*");
			myGrid.setColAlign("right,left");
			myGrid.setColTypes("dyn,ed");
			myGrid.setColSorting("str,str");
			myGrid.init();
			myGrid.load("../common/grid_16_rows_columns_manipulations.xml",function(){
				myGrid.selectRow(1)
			});
		}
	</script>
</head>
<body onload="doOnLoad()">
	<h1>Using Grid API Methods</h1>
	<p>Manipulate grid content, appearance and functionality using wide range of Grid API methods</p>
	<table width="600px">
		<tr>
			<td width="400px" valign="top">
				<div id="gridbox" style="width:350px;height:250px;"></div>
			</td>
			<td valign="top">
				<div id="gridbox2" style="width:250px;height:250px;border:1px solid blue;overflow:auto"></div>
			</td>
		</tr>
		<tr>
			<td>
				<a href="javascript:myGrid.setHeaderCol(1,'New Header')">setHeaderCol</a><br>
				<a href="javascript:myGrid.copyRowContent(myGrid.getRowId(0),myGrid.getSelectedId())">copyRowContent (ex.:from first to selected)</a><br>
				<a href="javascript:myGrid.clearSelection()">clearSelection</a><br>
				<a href="javascript:myGrid.setSelectedRow(myGrid.getRowId(1))">setSelectedRow (ex.:second)</a><br>
				<a href="javascript:myGrid.setEditable(!myGrid.isEditable)">setEditable (ex.:on/off)</a><br>
				<a href="javascript:myGrid.setUserData(myGrid.getSelectedId(),'ud2','this value was set with script')">setUserData (ex.: to selected row)</a><br>
				<a href="javascript:alert(myGrid.getUserData(myGrid.getSelectedId(),'ud2'))">getUserData (ex.: of selected row)</a><br>
				<a href="javascript:alert(myGrid.cells(myGrid.getSelectedId(),myGrid.getSelectedCellIndex()).getValue())">cells.getValue (ex.: of selected cell)</a><br>
				<a href="javascript:alert(myGrid.cells2(myGrid.getRowIndex(myGrid.getSelectedId()),myGrid.getSelectedCellIndex()).getValue())">cells2.getValue (ex.: of selected cell)</a><br>
				<a href="javascript:myGrid.moveRowDown(myGrid.getSelectedId())">moveRowDown (ex.:selected)</a><br>
				<a href="javascript:myGrid.moveRowUp(myGrid.getSelectedId())">moveRowUp (ex.:selected)</a><br>
				<a href="javascript:alert(myGrid.getColumnCount())">getColumnCount</a><br>
				<a href="javascript:alert(myGrid.getRowsNum())">getRowsNum</a><br>
				<a href="javascript:alert(myGrid.getAllItemIds())">getAllItemIds</a><br>
				<a href="javascript:alert(myGrid.isItemExists('14'))">isItemExists (with id=14)</a><br>
				<a href="javascript:myGrid.setRowTextStyle(myGrid.getSelectedId(),'color:red;font-family:verdana;font-size:14px;')">setRowTextStyle (ex.:selected)</a><br>
				<a href="javascript:myGrid.setRowTextBold(myGrid.getSelectedId())">setRowTextBold (ex.:selected)</a><br>
				<a href="javascript:myGrid.setRowTextNormal(myGrid.getSelectedId())">setRowTextNormal (ex.:selected)</a><br>
				<a href="javascript:myGrid.clearAll()">clearAll</a><br>
			</td>
			<td>
				<a href="javascript:myGrid.setColumnIds('A,B')">setColumnIds (A,B)</a><br>
				<a href="javascript:alert(myGrid.getColumnId(0))">getColumnId (ex.:first)</a><br>
				<a href="javascript:alert(myGrid.getColIndexById('B'))">getColIndexById (ex.: B)</a><br>
				<a href="javascript:myGrid.setRowId(myGrid.getRowIndex(myGrid.getSelectedId()),'newid')">setRowId (ex.: selected)</a><br>
				<a href="javascript:alert(myGrid.getRowId(myGrid.getRowIndex(myGrid.getSelectedId())))">getRowId (ex.:selected)</a><br>
				<a href="javascript:alert(myGrid.getRowIndex(myGrid.getSelectedId()))">getRowIndex (ex.:selected)</a><br>
				<a href="javascript:alert(myGrid.getColWidth(myGrid.getSelectedCellIndex()))">getColWidth (ex.:of selected cell)</a><br>
				<a href="javascript:alert(myGrid.getSelectedCellIndex())">getSelectedCellIndex</a><br>
				<a href="javascript:alert(myGrid.getSelectedId())">getSelectedId</a><br>
				<a href="javascript:myGrid.deleteSelectedItem()">deleteSelectedItem</a><br>
				<a href="javascript:void(0)" onclick="myGrid.deleteRow(myGrid.getSelectedId())">deleteRow (ex.: selected)</a><br>
				<a href="javascript:myGrid.setMultiselect(!myGrid.selMultiRows)">setMultiselect (on/off)</a><br>
				<a href="javascript:void(myGrid.addRow(myGrid.getUID(),'text 1,text 2',1))">addRow (ex.:second position)</a><br>
				<a href="javascript:myGrid.selectRow(0)">selectRow (ex.:first one)</a><br>
				<a href="javascript:myGrid.selectCell(1,1)">selectCell (ex.: second cell of second row)</a><br>
				<a href="javascript:myGrid.attachToObject(document.getElementById('gridbox2'))">attachToObject</a><br>
			</td>
		</tr>
	</table>
</body>
</html>
